package br.com.treinaweb.parte1;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.TextView;

public class Tela5 extends Activity implements OnClickListener {
  
  public void onCreate(Bundle savedInstanceState){
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_tela5);
    
    Button btnOk = (Button) findViewById(R.id.buttonOk);
    btnOk.setOnClickListener(this);
  }

  @Override
  public void onClick(View arg0) {
    // TODO Auto-generated method stub
    TextView resposta = (TextView) findViewById(R.id.textViewResposta);
    CheckBox chkAndroid = (CheckBox) findViewById(R.id.checkBoxAndroidBasico);
    CheckBox chkJava = (CheckBox) findViewById(R.id.checkBoxJavaBasico);
    CheckBox chkCSharp = (CheckBox) findViewById(R.id.checkBoxCSharpBasico);
    
    String msg = "Curso(s) selecionado(s): ";
    if(chkAndroid.isChecked())
      msg += chkAndroid.getText().toString() + " ";
    if(chkJava.isChecked())
      msg += chkJava.getText().toString() + " ";
    if(chkCSharp.isChecked())
      msg += chkCSharp.getText().toString() + " ";
    
    resposta.setText(msg);
  }

}
